package edu.bu.cs673.superkids123.parents.controller;

import edu.bu.cs673.superkids123.AbstractController;
import edu.bu.cs673.superkids123.AbstractFrame;
import edu.bu.cs673.superkids123.common.DataObjectAccess.ChildManager;
import edu.bu.cs673.superkids123.common.DataObjectAccess.ParentManager;
import edu.bu.cs673.superkids123.common.model.Child;
import edu.bu.cs673.superkids123.common.view.LoginView;
import edu.bu.cs673.superkids123.parents.view.ParentSettingsView;

public class CreateChildController extends AbstractController {

	public CreateChildController(AbstractFrame mainFrame) {
		super(mainFrame);
	}

	public void createChild(Child child) {
		// Perform add after initialized check
		if (authController.areChildrenInitialized()) {
			ChildManager.addChild(child);
			getMainFrame().changeView(ParentSettingsView.class);
		} else {
			ChildManager.addChild(child);
			getMainFrame().changeView(LoginView.class);
		}
	}
}
